#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define  MAXDWORD 0xffffffff
#define min(a,b) (a<b)?a:b

struct POINT
{
	int iX;
	int iY;
};

bool SortByHorizontal(const POINT &pt1,const POINT &pt2)
{
	return pt1.iX < pt2.iX;
}

double GetSqrt(const POINT &p1,const POINT &p2)
{
	return sqrt((p1.iX-p2.iX)*(p1.iX-p2.iX)
			+ (p1.iY-p2.iY)*(p1.iY-p2.iY));
}

float Distance(POINT *pPoint,int low,int high)
{
	float fMinDistance, fTemDistance;
	if (low == high)
		return (float)MAXDWORD;
	if (low == high-1)
	{
		return GetSqrt(pPoint[low],pPoint[high]);
	}
	fMinDistance = 
		min(Distance(pPoint,low,(low+high)/2),Distance(pPoint,(low+high)/2+1,high));
	int i,j;
	for (i = low;i != (low+high)/2+1;++i)
	{
		for (j = (low+high)/2+1;j != high+1;++j)
		{
			fMinDistance = min(fMinDistance,GetSqrt(pPoint[i],pPoint[j]));
		}
	}
	return fMinDistance;
}

int main()
{
	int i, iCount = 0;
	int n, m;
	POINT *pPoint;
	float *pDistance;
	cin >> n;
	pDistance = new float[n];
	while (iCount != n)
	{
		cin >> m;
		pPoint = new POINT[m];
		for (i = 0;i != m;++i)
		{
			cin >> pPoint[i].iX >> pPoint[i].iY;
		}
		sort(pPoint,pPoint+m,SortByHorizontal);
		pDistance[iCount++] = Distance(pPoint,0,m-1);
		delete []pPoint;
	}
	iCount = 0;
	cout << fixed << showpoint;
	while (iCount != n)
	{
		cout << setprecision(4) << pDistance[iCount++] << endl;
	}
}
